<template>
  <view>
    <view class="menuPanel">
      <view class="menuPanel_li" v-on:click="$navigateTo('/pages/system/accountSecurity')">
        <view class="menuPanel_li_label">账号与安全</view>
        <view class="menuPanel_li_arrow iconfont icon-you1"></view>
      </view>
      <view class="menuPanel_li" v-on:click="$navigateTo('/pages/my/editInfo')">
        <view class="menuPanel_li_label">编辑资料</view>
        <view class="menuPanel_li_arrow iconfont icon-you1"></view>
      </view>
    </view>
    <view class="menuPanel">
      <view class="menuPanel_li" v-on:click="APPUpdate()">
        <view class="menuPanel_li_label">版本更新</view>
        <view class="menuPanel_li_val">{{ version }}</view>
        <view class="menuPanel_li_arrow iconfont icon-you1"></view>
      </view>
      <view class="menuPanel_btn" v-on:click="logOut">退出</view>
    </view>
  </view>
</template>

<script>
import APPUpdate from "@/plugins/APPUpdate"
export default {
  components: {},
  data() {
    return {
      token: null,
      version: null,
    }
  },
  methods: {
    /**
     * 加载
     */
    async afterLoad(e) {
      let self = this
      plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) {
        self.version = wgtinfo.version
      })
      self.token = uni.getStorageSync("token")
      getApp().globalData.thatView = this
    },
    /**
     * 退出登录
     */
    logOut() {
      let self = this
      uni.showModal({
        title: '提示',
        content: "确定退出吗？",
        success: function (res) {
          if (res.confirm) {
            self.$api.logout().then(res => {
              self.removeUserStorage()
              self.$navigateTo('/pages/loginPage/telLogin')
            })
          }
        }
      })
    },
  }
}
</script>

<style lang="scss" scoped>
@import "../../static/css/menu.scss";
</style>
